/*************************************************************************
	> File Name: oj-151_YHO.c
	> Author: Wang Bo
	> Mail: 1276106221@qq.com
	> Created Time: 2020年10月18日 星期日 19时30分48秒
 ************************************************************************/

#include <stdio.h>
#include <stdlib.h>

#define ml m[0]
#define mr m[2]
#define ll l[0]
#define lr l[2]

int win(char a, char b) {
    if (a == b) {
        return 0;
    } else if ((a == 'O' && b == 'Y') || (a == 'Y' && b == 'H') || (a == 'H' && b == 'O')) {
        return 1;
    } else {
        return -1;
    }
}

int main() {
    char m[3] = {0}, l[3] = {0};
    scanf("%[^\n]", m);
    getchar();
    scanf("%[^\n]", l);
    
    int ans = win(ml, ll);
    if (ans == 0) {
        ans = win(mr, lr);
    } else if (ans > 0) {
        ans = win(ml, lr);
        if (ans < 0) {
            ans = win(mr, lr);
            if (ans <= 0) ans = -1;
        } else if (ans >= 0){
            ans = 1;
        } 
    } else if (ans < 0){
        ans = win(mr, ll);
        if (ans <= 0) {
            ans = -1;
        } else if (ans > 0){
            ans = win(mr, lr);
            if (ans >= 0) ans = 1;
        }
    }

    printf("%s", ans > 0 ? "MING" : ans == 0 ? "TIE" : "LIHUA");
    return 0;
}
